package FormatMapUtils

import "strings"

func FormatDBNameToVarName(dbname string)(string){
	var strs = strings.Split(dbname,"_")
	var result = make([]byte,0)
	for _,str := range strs {
		result = append(result,strings.ToUpper(str)[0])
		result = append(result, []byte(str)[1:]...)
	}
	result[0]=result[0]+('a'-'A')
	return string(result)
}

func FormatMapKey(m map[string]interface{})(map[string]interface{}){
	var result = make(map[string]interface{})
	for k,v:= range m {
		result[FormatDBNameToVarName(k)] = v
	}
	return result
}
func FormatMapKeyInSlice(m []map[string]interface{})([]map[string]interface{}){
	var result = make([]map[string]interface{},0,10)
	for _,v:= range m {
		result = append(result,FormatMapKey(v) )
	}
	return result
}
